package com.wn.consumer02;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * @author yellow Docter
 * @date 2023 -02-28
 * @desc
 */
@Component
@Slf4j
public class SeatConsumer {

    /**
     * @RabbitListener   监听
     *   bindings 绑定  @QueueBinding在注解
     *          value      属性 绑定对象
     *                   @Queue(name = "queue-fanout-member"), 队列注解 设置队列名称
     *
                exchange   属性  绑定交换机
     *                   @Exchange(
     *                             name = "exchange-fanout",       交换机的名称
     *                             type = ExchangeTypes.FANOUT     交换机的类型 （广播类型）
     *                     )
     * @param msg
     */
    @RabbitListener(
            bindings = @QueueBinding(
                    value = @Queue(name = "queue-fanout-seat"),
                    exchange = @Exchange(
                            name = "exchange-fanout",
                            type = ExchangeTypes.FANOUT
                    )
            )
    )
    public void handlerMsg(String msg){
        log.info("SeatConsumer 消费者消费:{}",msg);
    }

}
